package eg.ci.mvn.service.api.constant;


import eg.ci.mvn.service.api.dict.DictItemBean;
import eg.ci.mvn.service.api.dict.IDictItem;
import lombok.Getter;

/**
 * 进出场类型标志 1-待入场 2 已入场 3-待离场 4 已离场
 * @author dev
 */
@Getter
public enum InOutStateEnum implements IDictItem {
    /** 待入场 */
    PREPARE_ENTER("prepareEnter","待入场", "1"),
    /** 已入场 */
    ALREADY_ENTER("alreadyEnter","已入场", "2"),
    /** 待离场 */
    PREPARE_EXIT("prepareExit","待离场","3"),
    /** 已离场 */
    ALREADY_EXIT("alreadyExit","已离场", "4"),


    /** 未知 */
    UNKNOWN("unknown", "未知", "-1");

    /** 字典枚举目录 */
    private final static String CATEGORY = "InOutStateEnum";
    /** 字典枚举目录 LABEL */
    private final static String CATEGORY_LABEL = "进出场类型标志";

    /** 构造 */
    InOutStateEnum(String item, String itemLabel, String itemValue) {
        // 放入到内存
        putDictItem(DictItemBean.builder()
                .category(CATEGORY)
                .categoryLabel(CATEGORY_LABEL)
                .item(item)
                .itemLabel(itemLabel)
                .itemValue(itemValue)
                .build());
    }

    public static String getEnumItemLabel(final String itemValue) {
        return IDictItem.getEnumItemLabel(InOutStateEnum.class, itemValue, UNKNOWN.itemLabel() + "(" + itemValue+ ")");
    }

    public static InOutStateEnum getEnumAtItemValue(String itemValue) {
        return IDictItem.getEnum(InOutStateEnum.class, itemValue, UNKNOWN);
    }

}
